import type { ReactNode } from 'react'
import React from 'react'
import { useLocation } from 'react-router-dom'
import { localCache } from '@/utils/cache'
import { CacheType } from '@/global/constant'

interface IProps {
  children?: ReactNode
}

// ----------- ！！！！后续完善功能的时候记得再页面的search配置中完善pageKey，很多没写 ---------------
const WithButtonPermission = (WrappedComponent: any) => {
  return function WithButtonPermission(props: any) {
    const location = useLocation()
    const codeList = localCache.getCache(CacheType.MENU_CODE_LIST)
    console.log(location.pathname, codeList)
    console.log(props)
    return <WrappedComponent a={111} {...props}></WrappedComponent>
  }
}

export default WithButtonPermission
